home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / tests / matimp.tst < prev    next >
Text File  |  1999-09-16  |  810b  |  31 lines

  1. //   DAE's
  2. Leps=1.e-6;
  3. // scilab macros
  4. deff('[r]=resid(t,y,s)','...
  5. r(1)=-.04d0*y(1)+1.d4*y(2)*y(3)-s(1),...
  6. r(2)=.04d0*y(1)-1.d4*y(2)*y(3)-3.d7*y(2)*y(2)-s(2),...
  7. r(3)=y(1)+y(2)+y(3)-1.d0')
  8. deff('[p]=aplusp(t,y,p)','...
  9. p(1,1)=p(1,1)+1.d0,...
  10. p(2,2)=p(2,2)+1.d0')
  11. deff('[p]=dgbydy(t,y,s)','...
  12. p(1,1)=-.04d0,...
  13. p(1,2)=1.d4*y(3),...
  14. p(1,3)=1.d4*y(2),...
  15. p(2,1)=.04d0,...
  16. p(2,2)=-1.d4*y(3)-6.d7*y(2),...
  17. p(2,3)=-1.d4*y(2),...
  18. p(3,1)=1.d0,...
  19. p(3,2)=1.d0,...
  20. p(3,3)=1.d0')
  21. comp(resid);comp(aplusp);comp(dgbydy);
  22. //         calling scilab
  23. //  
  24. yt=impl([1;0;0],[-.04;.04;0],0,0.4,resid,aplusp,dgbydy);
  25. //  
  26. r1=yt-impl([1;0;0],[-0.04;0.04;0],0,0.4,resid,aplusp);
  27. if abs(r1) > 1.e-10 then pause,end
  28. //   calling fortran
  29. r2=yt-impl([1;0;0],[-0.04;0.04;0],0,0.4,'resid','aplusp');
  30. if abs(r2) > 1.e-10 then pause,end
  31.